package co.yixiang.yshop.server.chaos;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

@ConfigurationProperties(prefix = "yshop.chaos")
public class ChaosProperties {

    private boolean enable = false;
    private double probability = 0.0; // 0.0 ~ 1.0 之间
    private int delayMs = 0; // 线程休眠延迟
    private int cpuSpinMs = 0; // CPU 自旋时间
    private int allocateKb = 0; // 每次请求分配的内存（KB），请求结束即释放
    private List<String> includePaths; // 需要生效的路径模式（ANT），为空表示全部
    private List<String> excludePaths; // 需要排除的路径模式（ANT）

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public double getProbability() {
        return probability;
    }

    public void setProbability(double probability) {
        this.probability = probability;
    }

    public int getDelayMs() {
        return delayMs;
    }

    public void setDelayMs(int delayMs) {
        this.delayMs = delayMs;
    }

    public int getCpuSpinMs() {
        return cpuSpinMs;
    }

    public void setCpuSpinMs(int cpuSpinMs) {
        this.cpuSpinMs = cpuSpinMs;
    }

    public int getAllocateKb() {
        return allocateKb;
    }

    public void setAllocateKb(int allocateKb) {
        this.allocateKb = allocateKb;
    }

    public List<String> getIncludePaths() {
        return includePaths;
    }

    public void setIncludePaths(List<String> includePaths) {
        this.includePaths = includePaths;
    }

    public List<String> getExcludePaths() {
        return excludePaths;
    }

    public void setExcludePaths(List<String> excludePaths) {
        this.excludePaths = excludePaths;
    }
} 